<HTML><HEAD>
<TITLE>Alberto Ravell</TITLE>
<link rel="stylesheet" type="text/css" media="all" href="skins/aqua/theme.css" title="Aqua" />
<style type="text/css">
<!--
.Estilo4 {color: #990000}
.Estilo5 {font-weight: bold}
.Estilo6 {color: #FF0000}
.Estilo8 {color: #FF0000; font-weight: bold; font-size: 12px; }
.Estilo10 {
	color: #990000;
	font-weight: bold;
	font-size: 14px;
	font-family: Arial, Helvetica, sans-serif;
}
.Estilo12 {
	color: #000000;
	font-size: 14px;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-weight: bold;
}
.Estilo13 {color: #FF0000}
.Estilo7 {color: #FF0000; font-weight: bold; }
-->
</style>
<BODY text=#000000 vLink=#ff0000 aLink=#ff0000 link=#000000 bgColor=#ffffff 
topMargin=0 marginheight="0" >
<style type="text/css">
ul {
	list-style: none;
	padding: 0;
	margin: 0;
}
/* Para las letras*/
#nav a { 
	font-weight:  bold;
	color: #FFFFFF; /*red;*/
}

#nav a {
	text-decoration: none;
}
/*Letras de la lista*/
#nav li li a {
	display: block;
	font-weight: normal;
	color: #FFFFFF; /* #060;*/
	padding: 0.2em 10px;
}

#nav li li a:hover {
	padding: 0.2em 5px;
	border: 5px solid #000000; /*#7d6340;*/
	border-width: 0 5px;
}

li {
	float: left;
	position: relative;
	width: 10em;
	text-align: center;
	cursor: default;
	background-color: #FF0000; /* white;*/
	/*border: 1px solid #7d6340;
	border-width: 1px 0;*/
}

li#first {
	border-left-width: 1em;
}

li#last {
	border-right-width: 1em;
}

li ul {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;

	font-weight: normal;
	background: url(images/ddbg3.gif) bottom left no-repeat;
	padding: 0.5em 0 1em 0;
	border-right: solid 1px #7d6340;
}

li>ul {
	top: auto;
	left: auto;
}
/* formato de la Lista*/
li li {
	display: block;
	float: none;
	background-color: #FF0000; /* transparent;*/
	border: 0;
}

li:hover ul, li.over ul {
	display: block;
}

hr {
	display: none;
}

</style>

<script language="javascript" src="WYSIWYG/source.js" type="text/javascript">
</script>
<!-- import the calendar script -->
<script type="text/javascript" src="calendar.js"></script>

<!-- import the language module -->
<script type="text/javascript" src="lang/calendar-en.js"></script>

<!-- helper script that uses the calendar -->
<script type="text/javascript">

function selected(cal, date) {
  cal.sel.value = date; // just update the date in the input field.
  if (cal.dateClicked && (cal.sel.id == "sel1" || cal.sel.id == "sel3"))
    cal.callCloseHandler();
}
function closeHandler(cal) {
  cal.hide();                        // hide the calendar
//  cal.destroy();
  _dynarch_popupCalendar = null;
}
function showCalendar(id, format, showsTime, showsOtherMonths) {
  var el = document.getElementById(id);
  if (_dynarch_popupCalendar != null) {
    // we already have some calendar created
    _dynarch_popupCalendar.hide();                 // so we hide it first.
  } else {
    // first-time call, create the calendar.
    var cal = new Calendar(1, null, selected, closeHandler);
    // uncomment the following line to hide the week numbers
    // cal.weekNumbers = false;
    if (typeof showsTime == "string") {
      cal.showsTime = true;
      cal.time24 = (showsTime == "24");
    }
    if (showsOtherMonths) {
      cal.showsOtherMonths = true;
    }
    _dynarch_popupCalendar = cal;                  // remember it in the global var
    cal.setRange(1900, 2070);        // min/max year allowed.
    cal.create();
  }
  _dynarch_popupCalendar.setDateFormat(format);    // set the specified date format
  _dynarch_popupCalendar.parseDate(el.value);      // try to parse the text in field
  _dynarch_popupCalendar.sel = el;                 // inform it what input field we use
  _dynarch_popupCalendar.showAtElement(el.nextSibling, "Br");        // show the calendar

  return false;
}

var MINUTE = 60 * 1000;
var HOUR = 60 * MINUTE;
var DAY = 24 * HOUR;
var WEEK = 7 * DAY;

function isDisabled(date) {
  var today = new Date();
  return (Math.abs(date.getTime() - today.getTime()) / DAY) > 10;
}

function flatSelected(cal, date) {
  var el = document.getElementById("preview");
  el.innerHTML = date;
}

function showFlatCalendar() {
  var parent = document.getElementById("display");
  var cal = new Calendar(0, null, flatSelected);
  cal.weekNumbers = false;

  cal.setDisabledHandler(isDisabled);
  cal.setDateFormat("%A, %B %e");

  cal.create(parent);

  cal.show();
}

function compare_dates(fecha, fecha2){  
    var xMonth=fecha.substring(3, 5);  
    var xDay=fecha.substring(0, 2);  
    var xYear=fecha.substring(6,10);  
    var yMonth=fecha2.substring(3, 5);  
    var yDay=fecha2.substring(0, 2);  
    var yYear=fecha2.substring(6,10);  
    if (xYear> yYear){  
        return(true)  
    }  
    else{  
      if (xYear == yYear){   
        if (xMonth> yMonth){  
            return(true)  
        }  
        else{   
          if (xMonth == yMonth){  
            if (xDay> yDay)  
              return(true);  
            else  
              return(false);  
          }  
          else  
            return(false);  
        }  
      }  
      else  
        return(false);  
    }  
}  

function fecha_actual(){
    var fecha = new Date();
	var fechaActual;
	
    dia = fecha.getDate();
    mes = fecha.getMonth() +1;
    anio = fecha.getFullYear();
	
    if (dia <10) dia = "0" + dia;
    if (mes <10) mes = "0" + mes; 
	
    fechaActual = dia + "-" + mes + "-" + anio;
    return fechaActual;
}

function validar(){
	var msj = "false";
	
	if(document.form1.concepto.value == ""){
		document.form1.concepto.style.backgroundColor = "Yellow";	
		msj="true";
	}
	if(document.form1.centro.value == ""){
		document.form1.centro.style.backgroundColor = "Yellow";		
		msj="true";
	} 
	if(document.form1.factura.value == ""){
		document.form1.factura.style.backgroundColor = "Yellow";		
		msj="true";
	} 
	if(document.form1.monto.value == ""){
		document.form1.monto.style.backgroundColor = "Yellow";		
		msj="true";
	} 
	if(document.form1.fecini.value == ""){
		document.form1.fecini.style.backgroundColor = "yellow";
		msj="true";
	} 
	if(document.form1.fecini.value != ""){
		if(compare_dates(document.form1.fecini.value,fecha_actual())){
			alert("La Fecha no puede ser mayor a la Fecha Actual");
			return;
		}
	} 
	//Se verifica si no se llenaron algunos campos del formulario
	if(msj == "false"){ 
			if(document.form1.fecini.value != ""){
				/*fecha = document.form1.fecini.value;
				dia  =  parseInt(fecha.substring(0,2),10);
				mes  =  parseInt(fecha.substring(3,5),10);
				anio =  parseInt(fecha.substring(6),10);
				document.form1.fecini.value = anio+"-"+mes+"-"+dia;*/
			/*Agregado por Neiba*/
			fecha = document.form1.fecini.value;
			dia  =  fecha.substring(0,2);
        	mes  =  fecha.substring(3,5);
        	anio =  fecha.substring(6);
			document.form1.fecini.value = anio+"-"+mes+"-"+dia
			}	
		document.form1.submit();
	}else{
		alert("Debe ingresar los datos (*) requeridos");
	}
}
function cancelar(){
	document.form1.action ="consultarM.php";
	document.form1.submit();
}

</script>
<TABLE height=618 cellSpacing=3 cellPadding=0 width=549 align=center 
bgColor=#ffffff border=0>
  <td height="3"><TBODY>
  <TR>
    <TD vAlign=top width=543 bgColor=#ff0000 height=578>
	<?php
		include("Coneccion.php");
		$link=Conectarse();
		$cotnot=$_POST["id"];
		$result=mysql_query("SELECT *, DATE_FORMAT(fecha, '%d-%m-%Y') as fecfin FROM movimiento WHERE codMov = $cotnot;",$link);
		$row = mysql_fetch_array($result);
		$concepto=$row ["concepto"];
		$centro=$row ["centro"];
		$persona2=$row ["persona"];
		$factura=$row ["factura"];
		$fecini = $row ["fecfin"];
		$monto=$row ["monto"];
		$observaciones=$row ["observaciones"];
		$fechaMov=$row ["fechaMov"];
	 
		function persona(){
		    $link=Conectarse();
			$arr_per= array();
			$query = "SELECT ci,nombre,apellido FROM habitante WHERE mcc=1";
			$resul = mysql_query($query,$link);
			while ($row = mysql_fetch_array($resul)) {
				$arr_per [] = array ("ci" => $row ["ci"],	"nombre" =>$row ["nombre"],	  "apellido" =>$row ["apellido"]);				
			}
			return $arr_per;
		}
	?>
	<form name="form1" method="post" action="guardarMod.php">
	  <TABLE height=541 cellSpacing=1 width=541 align=center border=0>
        <TBODY>
        <TR>
          <TD width="537" height="518" vAlign=top bgColor=#ffffff>            <DIV align=center>
            <p>&nbsp;</p>
            <DIV align=center class="Estilo4">
              <p class="Estilo12">Modificar Movimiento</p>
              <p class="Estilo5 Estilo6">_________________________________________________</p>
            </DIV>
	    <TABLE height=401 cellSpacing=5 width=450 align=center  bgColor=#ffffff border=0>
              <TBODY>
              <TR>
                <TD width=445 bgColor=#ffffff height=391>
   
                  <table width="391">
                    <tr>
                      <td width="152"><span class="Estilo6">*</span> Concepto:</td>
                       <td><label>
                        <input name="concepto" type="text" id="concepto" size="31" maxlength="100"value = "<?php echo "$concepto"?>">
                      </label></td>
                    </tr>                   
					 <tr>
                      <td height="22"><p><span class="Estilo6">*</span> Centro de Costo:</p>                        </td>
                      <td><label>
						<input name="centro" type="text" id="centro" size="31" maxlength="100"value = "<?php echo "$centro"?>">
                      </label></td>
                    </tr>
                    <tr>
                      <td><span class="Estilo6">*</span> Factura:</td>
                      <td><input name="factura" type="text" id="factura" size="31" maxlength="20" value = "<?php echo "$factura"?>"></td>
                    </tr>
                      <tr>
                        <td height="24"><span class="Estilo6">*</span> Fecha:</td>
                      <td><input name="fecini" type="text" id="sel3" size="13" readonly="readonly" value="<?php if(strcmp($fecini,"00-00-0000")) echo "$fecini"?>"><input name="reset" type="reset" onClick="return showCalendar('sel3', '%d-%m-%Y');" value=" ... "></td>
					 </tr>
                    <tr>
                      <td><span class="Estilo6">*</span> Monto:</td>
                      <td><input name="monto" type="text" id="monto" size="31" maxlength="7" value = "<?php echo "$monto"?>"> </td>
                    </tr> 
                    <tr>
                      <td>&nbsp;&nbsp; Persona:</td>
                      <td><label>
					<?php
						$persona = persona();
						$sel="";
						echo"<select name=\"persona\" id=\"persona\" width = \"20%\" size = \"1\">";
						for($pos=0;$pos < count($persona);$pos++){
							if($persona[$pos]["ci"] == $persona2){
								$sel = "selected";
							} else {
									$sel = "";
								}
							echo "<option ".$sel." value=".$persona[$pos]["ci"]." "." onClick=\"\">".$persona[$pos]["nombre"]." ".$persona[$pos]["apellido"]."</option>";                      
						}
						echo "</select>";
					?>
                      </label></td>
                    </tr>					
                  </table>
                  <p>Observaciones: 
                    <textarea name="texto" cols="60" rows="4"><?php echo "$observaciones" ?></textarea> 
                    <label></label>
                    </p>
                  <p>
				  Fecha y Hora: <?php if (strcmp($fechaMov,"00-00-0000 00:00:00 ")) echo "$fechaMov"?> <br><br>
				  <span class="Estilo7">Los campos con * son obligatorios</span> </p>
                  <table width="358">
                    <tr>
                      <td width="226" align="right"><input type="button" name="button" value="Aceptar"  onClick="validar()" ></td>
                      <td width="87"><input type="button" name="Submit" value="Cancelar"  onClick="cancelar();">
                    </tr>
                  </table>                 
                  <p>
                    <label></label>
                  </p></TD>
              </TR></TBODY></TABLE>
            </DIV></TD>
        </TR>		  <input type="hidden" name="modo"  size="20" value ="update">
	  <input type="hidden" name="codnot"  size="20" value ="<?php echo $cotnot ?>">
			
	  </TBODY></TABLE>
	 
    </form></TD>
	  
</TR><td height="2"></TBODY>
</TABLE>
<p align="center" style="margin-top: 7; margin-bottom: 0">
        <font face="Arial" size="1">Copyright 2011 Consejo Comunal Alberto Ravell        </font>

</BODY></HTML>